package sum.book.order.api.fallback;

import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;
import sum.book.common.core.model.dto.SimpleEntity;
import sum.book.order.api.feign.BookOrderServerClient;

import static sum.book.common.core.utils.ResponseUtil.getSimpleEntity;


/**
 * @Auther: ZhangGN
 * @Description:
 * @Date 2022/12/20 10:48
 **/
@Component
public class BookOrderServerFallbackFactory implements FallbackFactory<BookOrderServerClient> {

    @Override
    public BookOrderServerClient create(Throwable cause) {
        return new BookOrderServerClient() {
            @Override
            public SimpleEntity<String> testFallback() {
                return getSimpleEntity(cause);
            }
        };
    }


}
